import time


def sort(lis):
    for i in range(0, len(lis) - 1):
        for j in range(len(lis) - 1):
            if lis[j] > lis[j + 1]:
                temp = lis[j]
                lis[j] = lis[j + 1]
                lis[j + 1] = temp


list1 = list(map(int, open('m1_sorted.txt', )))
list2 = list(map(int, open('m2_reverse.txt', )))
list3 = list(map(int, open('m3_shuffle.txt', )))
f_s = time.time()
sort(list1)
f_f = time.time()

g_s = time.time()
sort(list2)
g_f = time.time()
s_s = time.time()
sort(list3)
s_f = time.time()

print('m1_sorted', round((f_f - f_s) * 1000), 'milliseconds')
print('m2_reverse', round((g_f - g_s) * 1000), 'milliseconds')
print('m3_shuffle', round((s_f - s_s) * 1000), 'milliseconds')
